FROM php:7-cli

RUN apt-get -qq update && apt-get -qq install \
  curl libzip-dev ca-certificates libssl-dev \
  > /dev/null

RUN docker-php-ext-install zip pcntl

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

RUN mkdir -p /app
WORKDIR /app

COPY ./composer.json /app/composer.json
ENV COMPOSER_ALLOW_SUPERUSER=1
RUN composer install

COPY ./start.php /app/start.php
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

CMD ["/usr/local/bin/php", "/app/start.php", "start"]